home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
090
/
cmln0186.arc
/
HELP.ASM
< prev
next >
Wrap
Assembly Source File
|
1986-12-20
|
7KB
|
253 lines
Listing 1
;****************************************************************
;*** ***
;*** Special Function Key Program ***
;*** by ***
;*** Craig A. Lindley ***
;*** 6 Sutherland Place ***
;*** Manitou Springs, Co. 80829 ***
;*** August 28, 1985 ***
;*** for use with MSDOS 2.x ***
;*** ***
;****************************************************************
;
;
cseg segment para public 'code'
assume cs:cseg,ds:cseg
;
org 100h
;
entpt: jmp start
;
;****************************************************************
;*** beginning of program data area ***
;****************************************************************
;
;special function key titles - 6 chars max
;
titles db ' a: ' ;F1
db ' b: ' ;F2
db ' dir ' ;F3
db 'dir b:' ;F4
db ' A->B ' ;F5
db ' fmt B' ;F6
db 'fmt Bs' ;F7
db ' copy ' ;F8
db ' cls ' ;F9
db ' help ','$' ;F10
;
;set strings for special function keys
;
setstr db 27,'[0;59;"a:";13p' ;F1
db 27,'[0;60;"b:";13p' ;F2
db 27,'[0;61;"dir";13p' ;F3
db 27,'[0;62;"dir b:";13p' ;F4
db 27,'[0;63;"diskcopy a: b:";13p' ;F5
db 27,'[0;64;"format b:";13p' ;F6
db 27,'[0;65;"format b:/s";13p' ;F7
db 27,'[0;66;"copy";32p' ;F8
db 27,'[0;67;"cls";13p' ;F9
db 27,'[0;68;"a:help";13p' ;F10
db '$'
;
;reset strings for special function keys
;
resstr db 27,'[0;59;0;59p' ;F1
db 27,'[0;60;0;60p' ;F2
db 27,'[0;61;0;61p' ;F3
db 27,'[0;62;0;62p' ;F4
db 27,'[0;63;0;63p' ;F5
db 27,'[0;64;0;64p' ;F6
db 27,'[0;65;0;65p' ;F7
db 27,'[0;66;0;66p' ;F8
db 27,'[0;67;0;67p' ;F9
db 27,'[0;68;0;68p' ;F10
db '$'
;
;special display controlling function char strings
;
p_cur db 27,'[24;1f$' ;position cursor str
r_cur db 27,'[u$' ;restore cursor pos. str
s_cur db 27,'[s$' ;save cursor pos. str
h_vid db 27,'[0;1m$' ;high int. video str
r_vid db 27,'[0;7m$' ;low int. reverse video str
n_vid db 27,'[0;m$' ;normal video str
eol db 27,'[K$' ;erase to end of line str
;****************************************************************
;*** end of program data area ***
;****************************************************************
;
;
;****************************************************************
;*** ***
;*** start of the main program ***
;*** ***
;****************************************************************
;
start proc near
call sav_cur ;save the current cursor position
call display ;display spec. funct key labels
call res_cur
mov cx,2000 ;delay loop count
st1: push cx ;save it
;
call poll_keys ;is keyboard active ?
jz st2 ;if not then jump
;
;if key hit during delay - reset spec. funct. keys
;
mov dx,offset resstr ;pt at reset key string
call lout ;send to STDIO device
pop cx ;fix push on stack
jmp short st3
;
st2: pop cx ;restore inner loop count
loop st1
mov dx,offset setstr ;pt at set key string
call lout ;send to SDTIO device
;
;if you get here a key was pressed or time delay is up
;
st3: call norm_vid ;restore normal video
call sav_cur ;save the cursor position
call pos_cur ;position cursor line 23 char 0
call clreol ;erase spec. funct. key labels
call res_cur ;restore cursor to where it was
ret
;
start endp
;
;****************************************************************
;*** Program Subroutines ***
;****************************************************************
;
clreol proc near ;clear to end of line
push dx
mov dx,offset eol ;pt at ansi char str
call lout ;send to SDTIO device
pop dx
ret
clreol endp
;
pos_cur proc near ;position cursor line 23 char 0
push dx
mov dx,offset p_cur ;pt at ansi char str
call lout ;send to SDTIO device
pop dx
ret
pos_cur endp
;
sav_cur proc near ;save cursor position
push dx
mov dx,offset s_cur ;pt at ansi char str
call lout ;send to SDTIO device
pop dx
ret
sav_cur endp
;
res_cur proc near ;restore cursor position
push dx
mov dx,offset r_cur ;pt at ansi char str
call lout ;send to SDTIO device
pop dx
ret
res_cur endp
;
norm_vid proc near ;select normal video
push dx
mov dx,offset n_vid ;pt at ansi char str
call lout ;send to SDTIO device
pop dx
ret
norm_vid endp
;
hi_vid proc near ;select high int. video
push dx
mov dx,offset h_vid ;pt at ansi char str
call lout ;send to SDTIO device
pop dx
ret
hi_vid endp
;
rev_vid proc near ;select reverse video
push dx
mov dx,offset r_vid ;pt at ansi char str
call lout ;send to SDTIO device
pop dx
ret
rev_vid endp
;
chrout proc near ;output char to SDTIO device
push dx
mov dl,al ;move char to output reg
mov ah,6 ;console I/O function code
int 21h ;output it
pop dx
ret
chrout endp
;
lout proc near ;output line to SDTIO device
push ax
mov ah,9 ;line out function code
int 21h ;output it
pop ax
ret
lout endp
;
poll_keys proc near ;poll keyboard for activity
push ax
push dx
mov dl,-1 ;signal for key in
mov ah,6 ;console I/O function code
int 21h ;do it
pop dx
pop ax
ret ;Z flag set if no key available
poll_keys endp
;
display proc near ;display spec funct key labels
call pos_cur ;positon cursor on display
call clreol ;clear line 23
call hi_vid ;select high int. video
mov si,offset titles ;pt at key titles
mov cx,10 ;do for 10 key labels
mov dl,1 ;loop index
disp1: push cx ;save regs
push dx
mov al,dl ;get loop count
cmp al,10 ;is it 10 ?
jne disp2 ;if not then jump
;
;if index = 10 then display "10"
;
mov al,'1' ;display "1"
call chrout
mov al,'0' ;display "0"
call chrout
jmp short disp3
;
disp2: add al,'0' ;make index ascii
call chrout ;display index 1..9
;
disp3: call rev_vid ;select reverse video
mov cx,6 ;do for 6 chars of key title
disp4: lodsb ;get char from titles
call chrout ;display it
loop disp4
;
call hi_vid ;normal video
mov al,' ' ;output a space
call chrout
pop dx ;restore regs
pop cx
inc dl ;index=index+1
loop disp1
ret
display endp
;
cseg ends
end entpt